package ooday03;

public class Dog extends Animal implements Swim {
    public Dog() {
        setLevel(2);
    }

    public Dog(String name, int age, String color, String gender) {
        super(name, age, color, gender);
        setLevel(2);
    }

    @Override
    public void eat() {
        System.out.println(getColor() + "色的" + getAge() + "岁的狗狗" + getName() + "正在啃骨头...");
    }

    @Override
    public void drink() {
        System.out.println(getColor() + "色的" + getAge() + "岁的狗狗" + getName() + "正在喝水...");
    }

    @Override
    public void hunt(Animal a) {
        if (getLevel() > a.getLevel()) {
            System.out.println("小狗" + getName() + "成功狩猎了" + a.getName());
        } else {
            System.out.println("醒醒吧" + getName() + "!!你打不过" + a.getName() + "的!!");
        }
    }

    @Override
    public Dog giveBirthTo() {
        if (!(getGender().equals("female"))) {
            System.out.println(getName() + "是个男娃,不能生娃!!");
            return null;
        }
        if (getAge() <= 2) {
            System.out.println(getAge() + "岁的" + getName() + "还是个孩子,不能生娃");
            return null;
        }

        System.out.println(getColor() + "的" + getAge() + "岁的狗狗" + getName() + "生了一只小狗");
        return new Dog();
    }


    @Override
    public void swim() {
        System.out.println(getColor() + "色的" + getAge() + "岁的狗狗" + getName() + "正在游泳");
    }

    @Override
    public String toString() {
        return "Dog{name = " + getName() + ", age = " + getAge() + ", color = " + getColor() + ", gender = " + getGender() + ", level = " + getLevel() + "}";
    }

    public void lookHome() {
        System.out.println(getColor() + "色的" + getAge() + "岁的狗狗" + getName() + "正在看家...");
    }
}
